<%@page pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="../admin_head.jsp">
	<jsp:param value="用户信息" name="title" />
</jsp:include>
</head>
<body>
<div class="container-fluid">
		<div class="row">
			<div class="col-md-2"></div>
			<div class="col-md-8">
				<div class="panel panel-success" align="center">
				<div class="panel-heading">
				<h1 >课堂教学质量评价系统</h1><br/>当前用户:${user.nickName }&nbsp;&nbsp;&nbsp;
						当前用户角色：${user.userRole }
				&nbsp;&nbsp;&nbsp;&nbsp;<a href="userlist.action?userId=${user.id }"><button class="btn btn-sm btn-success">首页</button></a>
						<a href="${pageContext.request.contextPath }/user/user.action"> <button class="btn btn-sm btn-danger" > <B> 退出登录 </B> </button> </a></div>
				</div>
				
				<!-- 功能按钮start -->
				<jsp:include page="../user/admin_nav.jsp">
					<jsp:param value="用户界面" name="title" />
				</jsp:include>
				<div class="panel panel-success">
				<div class="panel panel-primary" style="margin-left: 300px;width:900px;margin-top:15px">
					<div class="panel-heading">
						<h3 class="panel-title">评价标准列表</h3>
					</div>
					<div class="panel-body">
							<div class="col-lg-2">
								<a href="${pageContext.request.contextPath }/user/addEiPage.action?userId=${user.id}" id="addHref">
									<button class="btn btn-block btn-primary" type="button" onclick="add()">新增评价标准</button>
								</a>
							</div>
							<div class="col-lg-2">
								<a href="${pageContext.request.contextPath }/user/addEvaItemsPage.action?operatorId=${user.id }&adderId=${user.id}">
									<button class="btn btn-block btn-success" type="button">我的评价标准</button>
								</a>
							</div>
							<div class="col-lg-2">
								<a href="${pageContext.request.contextPath }/user/addEvaItemsPage.action?operatorId=${user.id }">
									<button class="btn btn-block btn-success" type="button">全部评价标准</button>
								</a>
							</div>
						<table class="table table-hover table-bordered" >
							<thead>
								<tr align="center" style="font-weight: bold">
									<td>序号</td>
									<td>标准名称</td>
									<td>添加者</td>
									<td>操作</td>
								</tr>
							</thead>
							<tbody>
								<c:if test="${evaItemList ne null}">
									<c:forEach items="${evaItemList}" var="vo" varStatus="vs">
										<tr align="center">
											<td>${vs.count }</td>
											<td>${vo.name }</td>
											<td>${vo.adderName }</td>
											<td>
												<c:if test="${vo.adderId eq user.id }">
												<a href="${pageContext.request.contextPath }/user/modEiPage.action?userId=${user.id }&eiId=${vo.id}">
												<button class="btn btn-warning btn-sm" data-toggle="modal" data-target="#modEIModal"> 修改</button>
												</a>
												<a href="${pageContext.request.contextPath }/user/delEi.action?userId=${user.id }&eiId=${vo.id}">
												<button class="btn btn-danger btn-sm" type="button" onclick="del()"> 删除</button>
												</a>
												</c:if>
											</td>
										</tr>
									</c:forEach>
								</c:if>
							</tbody>
						</table>
						<button class="btn btn-success" onClick="location.href='userlist.action?userId=${user.id}'">返回</button>
						</div></div></div></div>
			<div class="col-md-2"></div>
		</div>
	</div>
</body>

<script type="text/javascript">
	function add(){
		var eiCounts = "${eiCounts}";
		var userType = "${user.userType}";
		if(userType == 3){
			if(eiCounts > 15){
				document.getElementById("addHref").href="#";
				alert("您当前添加的评价标准已经达到16条，无法继续添加");
			}
		}else if(userType ==2){
			if(eiCounts > 3){
				document.getElementById("addHref").href="#";
				alert("您当前添加的评价标准已经达到4条，无法继续添加");
			}
		}
		
		
	}
	function del(){
		document.getElementById("addHref").href="${pageContext.request.contextPath }/user/addEiPage.action?userId=${user.id}";
	}
</script>
</html>
